"""
    实现步骤：
        定义父类，并提供公共方法
        定义子类：并重写父类方法
        传递子类对象给调用者，可以看到不同子类执行效果不同
"""

class Dog(object):
    def work(self):
        print('指哪打哪')

class ArmyDog(Dog):
    def work(self):
        print('追击敌人')

class DrugDog(Dog):
    def work(self):
        print('追查毒品')

class Person(object):
    def work_with_dog(self,dog):
        dog.work()

armyDog = ArmyDog()
armyDog.work()

dd = DrugDog()
dd.work()

print('*-*'*30)

daqiu = Person()
daqiu.work_with_dog(armyDog)

daqiu.work_with_dog(dd)

